package huas.ant.mapper;

import com.github.pagehelper.Page;
import huas.ant.entity.Equipment;
import org.apache.ibatis.annotations.*;

@Mapper
public interface EquipmentMapper {
    /**
     * 分页列表查询
     */
    @Select("select * from equipment")
    Page<Equipment> page();
    /**
     * 添加设备
     */
    @Insert("insert into equipment (name, location, status, message) values " +
            "(#{name},#{location},#{status},#{message})")
    void insert(Equipment equipment);
    /**
     * 根据设备D查询设备信息
     */
    @Select("select * from equipment where id = #{id}")
    Equipment findById(Integer id);
    /**
     * 修改设备
     */
    void update(Equipment equipment);
    /**
     * 删除设备
     */
    @Delete("delete from equipment where id = #{id}")
    void delete(Integer id);

    @Update("ALTER TABLE equipment AUTO_INCREMENT = 1")
    void reset();
}
